todos = []

def add_todo():
    task = input("请输入代办事项: ")
    todos.append(task)
    print(f"已添加: {task}")

def show_todos():
    if not todos:
        print("没有待办事项")
    else:
        print("待办事项列表: ")
        for i , task in enumerate(todos,1):
            print(f"{i-1}. {task}")
def remove_todo():
    show_todos()
    index = int(input("请输入要删除的事项编号: "))
    if 0 <= index < len(todos):
        removed = todos.pop(index)
        print(f"已删除: {removed}")
    else:
        print("无效的编号")

while True:
    print("\n待办事项管理")
    print("1. 添加待办事项")
    print("2. 查看待办事项")
    print("3. 删除待办事项")
    print("4. 退出")
    choice = input("请选择操作: ")

    if choice == "1":
        add_todo()
    elif choice == "2":
        show_todos()
    elif choice == "3":
        remove_todo()
    elif choice == "4":
        print("再见！")
        break
    else:
        print("无效的选择")